import { request } from "./request.js";

// 获取detail页的信息
export function getDetaildata(iid) {
  return request({
    url: "/detail",
    params: {
      iid
    }
  })
}

// 借用home页的链接
export function getDetailMultidata(type, page) {
  return request({
    url: "/home/data",
    params: {
      type,
      page
    }
  })
}

export class Good {
  constructor(itemInfo, columns, services) {
    this.title = itemInfo.title
    this.desc = itemInfo.desc
    this.newPrice = itemInfo.price
    this.oldPrice = itemInfo.oldPrice
    this.discount = itemInfo.discountDesc
    this.columns = columns
    this.services = services
    this.realPrice = itemInfo.lowNowPrice
    this.discountBgColor = itemInfo.discountBgColor
  }
}

export class Shop {
  constructor(shopInfo) {
    this.shopLogo = shopInfo.shopLogo
    this.name = shopInfo.name
    this.cSells = shopInfo.cSells
    this.score = shopInfo.score
    this.cGoods = shopInfo.cGoods
  }
}

export class Params {
  constructor(itemParams) {
    this.table = itemParams.rule.tables[0];
    this.set = itemParams.info.set;
  }
}
export class Comment {
  constructor(rate) {
    this.avatar = rate.list[0].user.avatar;
    this.uname = rate.list[0].user.uname;
    this.content = rate.list[0].content;
    this.style = rate.list[0].style;
    this.images = rate.list[0].images;
    this.created = rate.list[0].created;
  }
}